import request from '@/utils/request';

// 列表查询
export function getList(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee',
		method: 'post',
		data: data,
	});
}

// 根据ID查询
export function getById(id: string | number): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee/' + id,
		method: 'get',
	});
}

// 批量删除
export function deleteAll(ids: string | number): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee/delete/' + ids,
		method: 'delete',
	});
}

// 保存新增
export function save(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee/save',
		method: 'post',
		data: data,
	});
}
// 修改
export function edit(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee',
		method: 'put',
		data: data,
	});
}

// 获取下载模板
export function getTemplate(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee/downloadTemplate',
		method: 'get',
		data: JSON.stringify({}),
		responseType: 'blob',
	});
}

// 上传
export function upload(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/employee/upload',
		method: 'post',
		data: data,
	});
}
